package me.ywd.api.exception.filter;

import com.netflix.zuul.ZuulFilter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Author Ye_Wenda
 * @Date 11/6/2017
 */
@Slf4j
@Component
public class ExceptionTestFilter extends ZuulFilter {

    @Override
    public String filterType() {
        return "post";
    }

    @Override
    public int filterOrder() {
        return 0;
    }

    @Override
    public boolean shouldFilter() {
        return true;
    }

    @Override
    public Object run() {
        throwException();
        return null;
    }

    private void throwException() {
        throw new RuntimeException("throw exception...");
    }
}
